﻿using HR60_PanelSoft.Model;
using HR60_PanelSoft.NetWork.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HR60_PanelSoft.NetWork.Sender
{
    class Sender_0114:BaseSender
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="panelNo"></param>
        /// 
        /// <param name="panel"></param>
        public Sender_0114(byte panelNo,Panel panel)
        {
            ExPanelPage airconPage = panel.airconPage;
            ExPanelPage heatingPage = panel.heatingPage;
            ExPanelPage newWindPage = panel.newWindPage;
            ExPanelPage bgmPage = panel.bgmPage;

            int airSum = 0;
            int heatSum = 0;
            int windSum = 0;
            int bgmSum = 0;

            if (airconPage != null)
            {
                airSum = airconPage.getMappingSubExDevice().Count;
            }

            if(heatingPage!= null){
                heatSum = heatingPage.getMappingSubExDevice().Count;
            }

            if (newWindPage != null)
            {
                windSum = newWindPage.getMappingSubExDevice().Count;
            }

            if (bgmPage != null)
            {
                bgmSum = bgmPage.getMappingSubExDevice().Count;
            }

            byte[] data = new byte[4];


            data[0] = (byte)airSum;
            data[1] = (byte)heatSum;
            data[2] = (byte)windSum;
            data[3] = (byte)bgmSum;



            this.package = Package.getPackage(0x01, 0x14, panelNo, 0x01, data);
            



        }

    }
}
